package ru.usu.gv.utils;

/**
 * @author spupyrev
 * 03.11.2008
 */
public class StringUtilities
{
	public static boolean equal(String a, String b)
	{
		if (a == null)
			a = "";
		if (b == null)
			b = "";
		return a.equals(b);
	}

	public static boolean isEmpty(String a)
	{
		return (a == null || a.equals(""));
	}

	public static String round2(double value)
	{
		String s = String.format("%.2f", value);
		if (s.indexOf(',') != -1)
		{
			while (s.charAt(s.length() - 1) == '0')
				s = s.substring(0, s.length() - 1);
			if (s.charAt(s.length() - 1) == ',')
				s = s.substring(0, s.length() - 1);
		}
		return s;
	}

}
